mugenfandomcom-20200222-history
AI Generator
AI Generator is a tool that automatically generates A.I. patches for characters that do not have custom A.I. It does this by calculating the frames and hitboxes of each move to determine when the character will use the move. The tool is best used as a starting point to making an A.I. patch, rather than a full substitute for custom A.I. A complete A.I. made with this will improvise based on the startup times of its attacks, its own distance from the opponent, and the length of the opponent's current animation. It also takes the opponent's y position and head/mid.pos into account, meaning it is less likely to use moves that will only go over the opponent's head or under an airborne opponent. Steps #Make a backup of the character. #Make sure the character does not already have custom A.I.. If it does, you can still remove the A.I. coding. #Copy and paste AI Generator's files into the character folder. If there's already a common1.cns, don't overwrite it. #If any .cmd, .cns, .st, or .air files are in their own subfolder, create a new folder named "AI-(the name of said subfolder)". For instance, if there is a CNS file in a folder called "CNS", you will need to create a folder called "AI-CNS". It is unnecessary to copy the files into the new folder, they will only be overwritten. #Delete any spaces from any .cmd, .cns, .st, and .air file names and do the same for their entries in the character's DEF. #Open a command prompt window in the character folder and run ai.exe or ai.py. It is not recommended to run it from Explorer because if it fails, the window will close immediately, not allowing you to read the error for troubleshooting. #If there are multiple DEF files, it will ask you to specify which one to scan. #The tool will now scan the DEF file and all .cmd, .cns, .st, and .air files it points to. If successful, there will be new files starting with "AI-". If it fails, consult the "Troubleshooting" section and make sure you've followed all previous steps. #Open the new AI-.def file and make sure it has st entries pointing to aihelper2.cns and aisummary.txt. (For example, "st2 = aihelper2.cns" and "st3 = aisummary.txt".) They are usually there, but if not, you must manually add them. Without these entries, the character will still use the default A.I. #Install the character folder into M.U.G.E.N like normal and enjoy. Troubleshooting *If any file has non-ASCII characters, the tool will give a charmap error. At the beginning, the tool lists all files it's scanning. Open one of these files in Notepad++. Press CTRL+H to call the "Replace" window, tick "Regular Expression" under "Search Mode" in the bottom left, put ^\x00-\x7F+ in "Find What", leave "Replace With" blank, and click "Replace All". This automatically deletes all non-ASCII characters. Repeat this process with the rest of the files in the scan list. *If it gives an "UnboundLocalError" relating to local variable "m0", try running ai.py instead of ai.exe. Otherwise it is unknown how to fix this error. *With ai.py, you may get the message "NameError: name 'n' is not defined". This is caused by too many human player commands in the CMD. *If M.U.G.E.N crashes while trying to load a match, it is likely related to aisummary.txt. Refer to the crash message for the problematic character and the specific line in aisummary. *If the character seems like it's still using M.U.G.E.N's default A.I., make sure that the character entry in select.def is pointing to the DEF beginning with "AI-" and not the original DEF. Also check the AI-.def and make sure it's referencing aihelper2.cns and aisummary.txt. (Refer back to step 9.) Limitations AI Generator struggles with moves that use helpers and will not generate coding for them, so the character will never use them. Likewise, it will skip past most moves that aren't attacks, with the exception of moves with universal state values like dashes. If the xscale and/or yscale value in the coding for the character uses a decimal, AI Generator will round down when it uses the decimal in its calculations, resulting in skewed attack spacing. For attacks with multiple hitboxes, it will only use the hitbox closest to the character in its calculations, meaning the character will typically only use longer-ranged moves when close up. It is recommended for a more experienced programmer to learn the calculations the tool uses and manually add any moves the tool skipped over, along with tweaking distance values. It also uses the WinMUGEN style of A.I. activation, so it will not always activate right away and will not use the in-game difficulty levels. Users of M.U.G.E.N 1.0 and above can fix this by simply opening aisummary.txt and replacing the activation triggers with a single "AILevel > 0" trigger, though they will still have to find their own way of icorporating the actual A.I. levels. Category:Tools